package com.atguigu.srb.core.controller.admin;


import com.atguigu.common.result.R;
import com.atguigu.srb.core.pojo.entity.UserLoginRecord;
import com.atguigu.srb.core.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户登录记录表 前端控制器
 * </p>
 *
 * @author tjf
 * @since 2022-01-03
 */
@RestController
@Api(tags = "会员登录日志接口")
//@CrossOrigin
@Slf4j
@RequestMapping("/admin/core/userLoginRecord")
public class AdminUserLoginRecordController {
    private final UserLoginRecordService userLoginRecordService;

    public AdminUserLoginRecordController(UserLoginRecordService userLoginRecordService) {
        this.userLoginRecordService = userLoginRecordService;
    }

    @ApiOperation("获取会员登录日志列表")
    @GetMapping("/listTop50/{userId}")
    public R listTop50(@ApiParam("用户id") @PathVariable Long userId) {
        List<UserLoginRecord> userLoginRecordList = userLoginRecordService.listTop50(userId);
        return R.ok().message("获取会员登录日志列表成功").data("list", userLoginRecordList);
    }


}

